package com.cloud.wms.ui.main.adapter.provider;

import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.provider.BaseNodeProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cloud.wms.R;
import com.cloud.wms.ui.main.adapter.MineTaskAdapter;
import com.cloud.wms.ui.main.entity.TaskEntity;

import org.jetbrains.annotations.NotNull;

/**
 * @Author:Chen
 * @Date: 2021-01-18 19:59
 * @Description:
 */
public class MineTaskProvider extends BaseNodeProvider {

    @Override
    public int getItemViewType() {
        return MineTaskAdapter.TASK;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_main_task;
    }

    @Override
    public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) {
        TaskEntity entity = (TaskEntity) data;
        helper.setText(R.id.tv_task_code, entity.getTaskCode())
                .setText(R.id.tv_task_key, entity.getTaskShortName())
                .setText(R.id.tv_task_value, entity.getMainBillCode())
                .setText(R.id.tv_task_create_time, entity.getCreateDate())
                .setGone(R.id.view_line, helper.getAdapterPosition() != 0)
                .setGone(R.id.btn_task_receive, true);
    }
}
